function firstNotRepeatingChar(ss){
    var i=0,j=1,count=0
    var flag=1
    while(j<ss.length){
	if(ss[j]==ss[i]){
        j++
    }else{
        if((j-i)==1){
            flag=0
            console.log(i)
            break
        }else{
            i=j++
        }
    }
    }
    if(flag==1){
        console.log(-1)
    }
}
const str="aabbcd"
firstNotRepeatingChar(str)